Skip to main content

Kaplan Meier Survival Curves Cont


The Log-Rank Test for Two Groups

When we state that two KM curves are "statistically equivalent," we mean that, based on a testing procedure that compares the two curves in some "overall sense," we do not have evidence to indicate that the true (population) survival curves are different.

In order to evaluate whether or not KM curves for two or more groups are statistically equivalent we use the most popular testing method called the log-rank test.

Definition

The log-rank test is a large-sample chi-square test that uses as its test criterion a statistic that provides an overall comparison of the KM curves being compared. This (log-rank) statistic, like many other statistics used in other kinds of chi-square tests, makes use of observed versus expected cell counts over categories of outcomes. The categories for the log-rank statistic are defined by each of the ordered failure times for the entire set of data being analyzed.

Example

Consider the comparison of the treatment (group 1) and placebo (group 2) subjects in the remission data on 42 leukemia patients. Let's take a look at the following table:

Here, for each ordered failure time, t(f)t_{(f)}, in the entire set of data, we show the numbers of subjects (mif)(m_{if}) failing at that time, separately by group (ii), followed by the numbers of subjects (nif)(n_{if}) in the risk set at that time, also separately by group.

Thus, for example, at week 4, no subjects failed in group 1, whereas two subjects failed in group 2. Also, at week 4, the risk set for group 1 contains 21 persons, whereas the risk set for group 2 contains 16 persons.

Similarly, at week 10, 1 subject failed in group 1, and no subjects failed at group 2; the risk sets for each group contain 15 and 8 subjects, respectively.

We now expand the previous table to include expected cell counts and observed minus expected values for each group at each ordered failure time. The formula for the expected cell counts is shown here for each group. For group 1, this formula computes the expected number at time ff (i.e., e1fe_{1f}) as the proportion of the total subjects in both groups who are at risk at time ff, that is, n1f/(n1f+n2f)n_{1f} /(n_{1f} + n_{2f}), multiplied by the total number of failures at that time for both groups (i.e., m1f+m2fm_{1f} + m_{2f}). For group 2, e2fe_{2f} is computed similarly.

In general, we have:

We have the new table:

When two groups are being compared, the log-rank test statistic is formed using the sum of the observed minus expected counts over all failure times for one of the two groups. In this example, this sum is 10.26-10.26 for group 1 and 10.2610.26 for group 2. We will use the group 2 value to carry out the test, but as we can see, except for the minus sign, the difference is the same for the two groups.

For the two-group case, the log-rank statistic, shown below, is computed by dividing the square of the summed observed minus expected score for one of the groups - say, group 2 - by the variance of the summed observed minus expected score.

Log-rank statistic =

(O2E2)2Var(O2E2)\frac{(O_2-E_2)^2}{\mathrm{Var}(O_2-E_2)}

The expression for the estimated variance is shown here. For two groups, the variance formula is the same for each group. This variance formula involves the number in the risk set in each group (nifn_{if}) and the number of failures in each group (mifm_{if}) at time ff. The summation is over all distinct failure times.

Var(OiEi)=jn1fn2f(m1f+m2f)(n1f+n2fm1fm2f)(n1f+n2f)2((n1f+n2f1)\mathrm{Var}(O_i-E_i)=\sum_{j}\frac{n_{1f}n_{2f}(m_{1f}+m_{2f})(n_{1f}+n_{2f}-m_{1f}-m_{2f})}{(n_{1f}+n_{2f})^2((n_{1f}+n_{2f}-1)}

where i=1,2i = 1, 2

The null hypothesis being tested is that there is no overall difference between the two survival curves. Under this null hypothesis, the log-rank statistic is approximately chi-square with one degree of freedom. Thus, a P-value for the log-rank test is determined from tables of the chi-square distribution.

H0:no difference between survival curvesH_0: \text{no difference between survival curves}

Log-rank statistic ~χ2\chi^2 with 1 df under H0H_0

Although the use of a computer is the easiest way to calculate the log-rank statistic, we can still calculate it by hand. We have already seen from earlier computations that the value of O2E2O_2-E_2 is 10.2610.26. The estimated variance of O2E2O_2 -E_2 is computed from the variance formula above to be 6.26856.2685. The log-rank statistic then is obtained by squaring 10.2610.26 and dividing by 6.2856.285, which yields 16.79316.793.

An approximation to the log-rank statistic, shown here, can be calculated using observed and expected values for each group without having to compute the variance formula. The approximate formula is of the classic chi-square form that sums over each group being compared the square of the observed minus expected value divided by the expected value

The approximate formula is:

X2inumber of groups(OiEi)2EiX^2\approx\sum_{i}^{\text{number of groups}}\frac{(O_i-E_i)^2}{E_i}

The calculation of the approximate formula is shown here for the remission data. The expected values are 19.2619.26 and 10.7410.74 for groups 1 and 2, respectively. The chi-square value obtained is 15.276, which is slightly smaller than the log-rank statistic of 16.79316.793.

X2=(10.26)219.26+(10.26)210.74=15.276X^2 = \frac{(-10.26)^2}{19.26}+\frac{(10.26)^2}{10.74}=15.276

The Log-Rank Test for Several Groups

The log-rank test can also be used to compare three or more survival curves. The null hypothesis for this more general situation is that all survival curves are the same.

H0=All survival curves are the sameH_0 = \text{All survival curves are the same}

Log-rank statistics for > 2 groups involves variances and covariances of OiEiO_i-E_i.

In such case, we can use computer to do the computation. Therefore, we will not go into too much detials here. But, one thing we need to notice is, for G(2)G(\ge 2) groups, the log-rank statistic ~ χ2\chi^2 with G1G-1 df.


Confidence Intervals for KM Curves

We now describe how to calculate 95% confidence intervals (CIs) for the estimated Kaplan-Meier (KM) curve. The 95% CI formula for estimated KM probability at any time point over follow-up has the general large sample form shown below, where S^KM(t)\hat{S}_{KM}(t) denotes the KM survival estimate at time tt and Var[S^KM(t)]\mathrm{Var}[\hat{S}_{KM}(t)] denotes variance of S^KM(t)\hat{S}_{KM}(t). The most common approach used to calculate this variance uses the Greenwood's formula, also shown below.

95% CI for the KM curve:

S^KM(t)±1.95Var^[S^KM(t)]\hat{S}_{KM}(t)\pm1.95\sqrt{\hat{\mathrm{Var}}[\hat{S}_{KM}(t)]}

Where Greenwood's formula for Var^[S^KM(t)]\hat{\mathrm{Var}}[\hat{S}_{KM}(t)] is given by:

Var^[S^KM(t)]=(S^KM(t))2f:t(t)tmfnf(nfmf)\hat{\mathrm{Var}}[\hat{S}_{KM}(t)]=(\hat{S}_{KM}(t))^2\sum_{f:t_{(t)}\le t}\frac{m_f}{n_f(n_f-m_f)}

t(f)=t_{(f)}= ff-ordered failure time

mf=m_f= number of failures at t(f)t_{(f)}

nf=n_f= number in the risk set at t(f)t_{(f)}

The summation component of Greenwood's formula essentially gives at each failure time t(f)t_{(f)}, a weighted (by 1/nf1/n_f) average of the conditional risk of failing at those failure times prior to t(f)t_{(f)}. Thus, the variance formula gives the square of the KM coordinate at each event time weighted by the cumulative estimate of the risk at time tt.

We illustrate how Greenwood's variance is calculated for the treatment group (Group 1) of the remission times data described earlier. The layout for this computation is shown below.

At 6 weeks, the estimate of the survival function is 0.8570.857. There were three events at 6 weeks and 21 patients at risk. Therefore, mf/nf(nfmf)=3/(21×18)=0.0079m_f/n_f(n_f - m_f)=3/(21 \times 18) = 0.0079. As this is the only component of the sum, the variance is then 0.0079×0.8572=0.00580.0079 \times 0.8572 = 0.0058. The corresponding 95% confidence interval is shown below, where the upper level should be modified to 1.

At 10 weeks, the estimate of the survival function is 0.7530.753. There was 1 event at 10 months and 15 patients at risk. Therefore, mf/nf(nfmf)=1/(15×14)=0.0048m_f/n_f(n_f - m_f)= 1/ (15\times14) = 0.0048.

f:t(t)t=10mfnf(nfmf)=0.0079+0.0037+0.0048=0.0164\sum_{f:t_{(t)}\le t=10}\frac{m_f}{n_f(n_f-m_f)}=0.0079+0.0037+0.0048=0.0164
Var^[S^KM(t)]=(0.753)2(0.0164)=0.0093\hat{\mathrm{Var}}[\hat{S}_{KM}(t)]=(0.753)^2(0.0164)=0.0093

95% CI: 0.753±1.960.0093=(0.564,0.942)0.753\pm 1.96\sqrt{0.0093}=(0.564,0.942)